In [1]:
using ViscousFlow
In [2]:
using Plots
pyplot()
clibrary(:colorbrewer)
default(grid = false)
In [3]:
xlim = (-2,2); ylim = (-2,2)
Δx = 0.02
Re = 200
Out[3]:
In [4]:
Δt = min(0.5*Δx,0.5*Δx^2*Re)
Out[4]:
In [5]:
sys = NavierStokes(Re,Δx,xlim,ylim,Δt)
Out[5]:
In [6]:
w₀ = Nodes(Dual,size(sys));
In [7]:
xg,yg = coordinates(w₀,dx=Δx,I0=Systems.origin(sys))
Out[7]:
In [8]:
using LinearAlgebra
gaussian(x,x0,σ) = exp(-LinearAlgebra.norm(x.-x0)^2/σ^2)/(π*σ^2)
Out[8]:
In [9]:
plan_intfact(t,w) = Systems.plan_intfact(t,w,sys)
Out[9]:
In [10]:
r₁(w,t) = Systems.r₁(w,t,sys)
Out[10]:
In [11]:
ifrk = IFRK(w₀,sys.Δt,plan_intfact,r₁,rk=TimeMarching.RK31)
Out[11]:
In [12]:
t = 0.0
x01 = (-0.5,0); x02 = (0.5,0); σ = 0.2; Γ = 1
w₀ .= [Γ*gaussian((x,y),x01,σ) + Γ*gaussian((x,y),x02,σ) for x in xg, y in yg]*Δx
w = deepcopy(w₀);
In [16]:
tf = 5
T = 0:Δt:tf;
In [17]:
@time for ti in T
global t, w = ifrk(t,w)
end
In [18]:
plot(xg,yg,w)
Out[18]:
In [ ]: